<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<input type="text" id="i1">
<input type="button" value="猜一猜" onclick="myfn()">
<div id="d1"></div>
<script type="text/javascript">
//获取0-99随机整数
var x=parseInt(Math.random()*100);
var count=0;
function myfn(){
	count++;
	if(i1.value>x){
		d1.innerText="偏大";
	}else if(i1.value<x){
		d1.innerText="偏小";
	}else{
		d1.innerText="恭喜你第"+count+"次猜对了"
	}
}
</script>
</body>
</html>